home *** CD-ROM | disk | FTP | other *** search
- #include <bios.h>
- #include <dos.h>
- #include <conio.h>
- #include <graphics.h>
- #include <string.h>
-
-
-
- ///////////////////////
- #pragma warn -par
-
- char biosgetch()
- { char c;
- do{
- c= bioskey(_KEYBRD_READ) &0xff;
- }while (c=='\0');
- return c;
- }
- int getmode()
- {
- asm{
- mov ax, 0x40
- mov es, ax
- mov bx, 0x49
- mov al, byte ptr es:[bx]
- xor ah,ah
- }
- return _AX;
- }
-
- static buff[2000];
-
- char say_Retry_Or_Fail()
- { char *text= "Retry or Fail?";
- char c;
- int x1,y1,x2,y2;
- int mode=getmode();
- if (mode <=3 || mode==7)
- {
- x1=20;
- x2=38;
- y1=12;
- y2=y1+2;
- gotoxy(x1,y1);
- textattr(4);
- gettext(x1,y1,x2,y2,buff);
- cprintf("░░░░░░░░░░░░░░░░░░");
- gotoxy(x1+2,y1+1);
- cprintf(text);
- gotoxy(x1,y2);
- cprintf("░░░░░░░░░░░░░░░░░░");
- textattr(7);
- }
- else
- {
- int xc, yc, w, h;
- xc= getmaxx() /2;
- yc= getmaxy() /2;
- w=(strlen(text)+2) * 8;
- h=20;
- x1=xc-w /2;
- x2=xc+ w/2;
- y1=yc- h/2;
- y2=yc+ h/2;
- int oldcolor=getcolor();
- struct fillsettingstype oldfillinfo;
- getfillsettings (&oldfillinfo);
- struct textsettingstype oldtexttypeinfo;
- gettextsettings(&oldtexttypeinfo);
-
- setfillstyle(SOLID_FILL,WHITE);
-
- settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
- settextjustify(CENTER_TEXT,CENTER_TEXT);
- getimage(x1,y1,x2,y2,buff);
-
- bar(x1,y1,x2,y2);
- setcolor(RED);
- setwritemode(COPY_PUT);
- outtextxy((x1+x2) /2, (y1+y2)/2,text);
- setcolor(oldcolor);
- setfillstyle(oldfillinfo.pattern,oldfillinfo.color);
- settextstyle(oldtexttypeinfo.font,oldtexttypeinfo.direction,oldtexttypeinfo.charsize);
- settextjustify(oldtexttypeinfo.horiz,oldtexttypeinfo.vert);
- }
- c= biosgetch();
- if (mode <=3 || mode==7)
- {
- puttext(x1,y1,x2,y2,buff);
- }
- else
- {
- putimage(x1,y1,buff,COPY_PUT);
- }
- return c;
- }
-
-
- int handler(int errval,int ax,int bp,int si)
- { char c; int code;
- da_capo:
-
- c=say_Retry_Or_Fail();
- switch(c)
- {
- case 'R': case 'r':
- code=1;
- break;
- case 'F': case 'f':
- code=0;
- break;
- default: goto da_capo;
- }
- hardresume(code);
- return 2; // ABORT;
- }
-
- #pragma warn +par
-
-
- void setharderr()
- {
-
- harderr(handler);
- }
-
-
- #pragma startup setharderr 70